<?php
     if(isset($_GET['secao'])){
                    session_start();
                    if(strcmp(session_id(),$_GET['secao'])==1){
                        header('Location: Login.php');
                    }
                   echo "<html>";
                        echo    "<head>";
                           echo "<title></title>";
                            echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">";
                            echo "<Link rel=\"stylesheet\" href=\"Forms.css\" type=\"text/css\"/>";
                        echo "</head>";

                 
                        if(isset ($_GET['act']) && strcasecmp($_GET['act'],"alt")==0){
                            include_once 'Conexao.php';
                            $bd = new Conexao();
                            $bd->conectar();
                            $chave = $_GET['id'];
                            $obj=$bd->selectInjetaveis($chave,2);
                            $info = mysql_fetch_array($obj);
                            $act = "altInjetaveis";
                       }else{
                           $act = "cadInjetaveis";
                       }
                    

            echo "<body>";
                echo "<form method=\"POST\" action=\"Inserts.php?act=".$act."&id="; if(isset($_GET['id'])){ echo $_GET['id'];}else echo null; echo "\"  enctype=\"multipart/form-data\">";
                    echo "<table><caption>Dados Agendamento</caption>";
                        echo "<tr/>";
                            echo "<td/>*Nome do cliente:";
                            echo "<td/><input type=\"text\" name=\"nome\" value=\""; if(isset($info['nome']))echo $info['nome']; echo "\">";
                        echo "<tr/>";
                            echo "<td/>*Idade:";
                            echo "<td/><input type=\"text\" name=\"idade\" value="; if(isset($info['idade']))echo $info['idade']; echo">";
                        echo "<tr/>";
                            echo "<td/>*Bairro:";
                            echo "<td/><input type =\"text\" name=\"bairro\" value=\""; if(isset($info['bairro']))echo $info['bairro']; echo "\">";
                        echo "<tr/>";
                            echo "<td/>*Sexo:";
                            echo "<td/><input type=\"radio\" name=\"sexo\" title=\"Masculino\" value=\"1\"";
                                 if(isset($info['sexo']) && strcasecmp($info['sexo'],"1")==0)echo " checked=yes >Masculino"; else echo ">Masculino";
                            echo "<BR/>";
                            echo "<input type=\"radio\" name=\"sexo\" title=\"Feminino\" value=\"2\"";
                             if(isset($info['sexo']) && strcasecmp($info['sexo'],"2")==0)echo " checked=yes >Feminino"; else echo ">Feminino";
                        echo "<tr/>";
                            echo "<td/>*Telefone:";
                            echo "<td/><input type =\"text\" name=\"tel\" value="; if(isset($info['telefone']))echo $info['telefone']; echo ">";
                        echo "<tr/>";
                            echo "<td/>*Endereço:";
                            echo "<td/><input type =\"text\" name=\"endereco\" value=\""; if(isset($info['endereco']))echo $info['endereco']; echo "\">";
                        echo "<tr/>";
                            echo "<td align=\"right\">";
                            echo "<input type=\"submit\" name=\"enviar\" value=\"Confirmar\">";
                            echo "<td/>";
                            echo "<input type=\"reset\" name=\"limpar\" value=\"Limpar\">";
                    echo "</table>";
                echo "</form>";

            echo "</body>";
        echo "</html>";
     }else{
       header('Location: Login.php');
 }
 ?>
